package cc.hwtech;

import cc.hwtech.repaid.Gen;
import com.google.common.annotations.VisibleForTesting;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

@Mojo(name = "repaid-generate", requiresProject = true, threadSafe = true, defaultPhase = LifecyclePhase.GENERATE_SOURCES)
public class RepaidGenMojo extends AbstractMojo {
    @Parameter(defaultValue = "file://${project.basedir}/src/main/resources/repaid-generator.xml", required = true)
    private String configurationFile;

    public void execute()
            throws MojoExecutionException {
        try {
            Gen.generator(this.configurationFile);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
